package com.petalsgroup.petals.dao.Animation.impl;

import com.petalsgroup.petals.dao.Animation.CategoryDao;
import com.petalsgroup.petals.pojo.CategoryDO;
import com.petalsgroup.petals.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class CategoryDaoImpl implements CategoryDao {
    private JdbcTemplate jdbcTemplate = new JdbcTemplate(JDBCUtils.getDataSource());

    @Override
    public List<CategoryDO> listCategory() {
        String sql = "select * from category";
        List<CategoryDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(CategoryDO.class));
        return list;
    }
}
